package com.wanpinghui.wphlibrary.model.user.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 功能描述
 * author:caitiangui
 * time:2017/12/6
 */

public class AreaBean implements Parcelable {

    private String adcode;
    private String name;

    public void setSubs(List<AreaBean> subs) {
        this.subs = subs;
    }

    private List<AreaBean> subs;
    private boolean all;
    private int engineer_quantity;   // (integer, optional): 工程商总数 ,
    private int firend_quantity;    //(integer, optional): 当前省份好友数 ,
    private int id;                  // (integer, optional): 区域省份id ,
    private Integer bid_point;

    public AreaBean() {

    }

    public AreaBean(String name, boolean isSelect) {
        this.name = name;
        this.isSelect = isSelect;
    }

    protected AreaBean(Parcel in) {
        adcode = in.readString();
        name = in.readString();
        subs = in.createTypedArrayList(AreaBean.CREATOR);
        all = in.readByte() != 0;
        engineer_quantity = in.readInt();
        firend_quantity = in.readInt();
        id = in.readInt();
        isSelect = in.readByte() != 0;
    }

    public static final Creator<AreaBean> CREATOR = new Creator<AreaBean>() {
        @Override
        public AreaBean createFromParcel(Parcel in) {
            return new AreaBean(in);
        }

        @Override
        public AreaBean[] newArray(int size) {
            return new AreaBean[size];
        }
    };

    public String getAdcode() {
        return adcode;
    }

    public String getName() {
        return name;
    }

    public List<AreaBean> getSubs() {
        return subs;
    }

    private boolean isSelect;

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public List<AreaBean> getChildren() {
        return subs;
    }

    public boolean isAll() {
        return all;
    }

    public void setAll(boolean all) {
        this.all = all;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getEngineer_quantity() {
        return engineer_quantity;
    }

    public void setEngineer_quantity(int engineer_quantity) {
        this.engineer_quantity = engineer_quantity;
    }

    public int getFirend_quantity() {
        return firend_quantity;
    }

    public void setFirend_quantity(int firend_quantity) {
        this.firend_quantity = firend_quantity;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(adcode);
        dest.writeString(name);
        dest.writeTypedList(subs);
        dest.writeByte((byte) (all ? 1 : 0));
        dest.writeInt(engineer_quantity);
        dest.writeInt(firend_quantity);
        dest.writeInt(id);
        dest.writeByte((byte) (isSelect ? 1 : 0));
    }

    public Integer getBid_point() {
        return bid_point;
    }

    public void setBid_point(Integer bid_point) {
        this.bid_point = bid_point;
    }
}
